<template>
	<view class="active">
		<view class="active-list">
			<view class="active-item" v-for="item in userLogList" :key="item.id">
				<view class="node">
					<view class="circle"></view>
					<view class="line"></view>
				</view>
				<view class="item">
					<view class="time">{{item.createTime}}</view>
					<view class="content">{{item.content}}</view>
				</view>
			</view>
		</view>
		<goTop @goTop="goTop"></goTop>
	</view>
</template>

<script>
	import goTop from "@/components/goTop/goTop.vue"
	export default {
		data() {
			return {
				userLogList:[]
			}
		},
		comments:{
			goTop
		},
		onLoad:function(){
			//获取token
			let token = uni.getStorageSync("token");
			console.log(!token);
			if( !token){
				// uni.showToast({
				// 	title: "请先登录！！"
				// })
				uni.redirectTo ({
					url: "/pages/login/login"
				});
			}
			this.getUserLogList();
		},
		methods: {
			//返回顶部
			goTop(){
				console.log(0);
				uni.pageScrollTo({
					scrollTop: 0
				})
			},
			//查询用户日志
			async getUserLogList(){
				const resp = await this.$myRequest({
					url : "/api/student/user/log"
				});
				if(resp.data.code == 200){
					this.userLogList = resp.data.obj;
				}
			}
		}
	}
</script>

<style lang="scss">
.active{
	display: flex;
	justify-content: center;
	flex-direction: column;
	align-items: center;
	width:100%;
	height: 100%;
	box-sizing: border-box;
	margin-bottom: 20rpx;
	padding-top: 90rpx;
	padding-bottom: 20rpx;
	.active-list{
		width:100%;
		height: 100%;
	}
	.active-item{
		width: 92%;
		// margin-top: 30rpx;
		display: flex;
		.node{
			display: flex;
			flex-direction: column;
			align-items: center;
			width: 10%;
			.circle{
				width: 32rpx;
				height: 32rpx;
				border-radius: 50%;
				background: var(--themeColor);
			}
			.line{
				background: rgba(102,187,106,0.5);
				width: 8rpx;
				height: 200rpx;
			}
		}
		.item{
			margin:0 40rpx;
			width: 90%;
			height: 128rpx;
			background-color: #fff;
			display: flex;
			// justify-content: center;
			align-items: center;
			border-radius: 20rpx;
			box-sizing: border-box;
			font-size: 28rpx;
			color: #212121;
			position: relative;
			.time{
				color:#fff;
				font-size: 24rpx;
				width: 50%;
				height: 60rpx;
				display: flex;
				justify-content: center;
				align-items: center;
				background-color: var(--themeColor);
				border-radius: 20rpx;
				padding: 2rpx 8rpx;
				position: absolute;
				left: 0;
				top: 0;
				transform: translate(-10%,-50%);
				
			}
			.content{
				letter-spacing: 2rpx;
				margin-left: 30rpx;
				margin-top: 10rpx;
			}
		}
	}
	.active-item:last-child{
		.line{
			display: none;
		}
	}
}
</style>
